package com.db.cm.app.controller;


import com.db.cm.app.model.StockDO;
import com.db.cm.app.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author YOURSLIHUA
 * @since 2023-11-24
 */
@RestController
@RequestMapping("/stockDO")
public class StockController {

    @Autowired
    StockService stockDOService;

    @PostMapping("/add")
    public boolean add(@RequestParam StockDO stockDO) {
        return stockDOService.add(stockDO);
    }

    @PostMapping("/delete")
    public boolean deleteById(@RequestParam StockDO StockDO) {
        return stockDOService.delete(StockDO);
    }

    @PostMapping("/update")
    public boolean update(@RequestParam StockDO StockDO) {
        return stockDOService.delete(StockDO);
    }

    @PostMapping("/selectAll")
    public List<StockDO> selectAll() {

        return stockDOService.selectAll();
    }

    @PostMapping("/selectById")
    public StockDO selectById(@RequestParam StockDO StockDO) {
        return stockDOService.selectById(StockDO.getGoodsId());
    }
}

